using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FreeLancer.HRB.Core.Web.Controls;
using FreeLancer.HRB.Core;

namespace FreeLancer.HRB.WebApp
{
  public partial class Events : WebBasePage
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      //EventsDataSource.Parameters.Add("LanguageId", _languageId.ToString());
      EventsDataSource.Parameters.Add("WhereClause", "LanguageID = " + _languageId.ToString() 
        + " AND IsPublished='True'");
      EventsDataSource.Parameters.Add("OrderBy", "DateCreated DESC");

      ASPxNewsControl.NavigateUrlFormatString = Utils.RelativeWebRoot + "Event.aspx?id={0}";

      //anchorMoreNews.HRef = Utils.RelativeWebRoot + "Events.aspx";
      anchorCategoryTitle.InnerText = Resources.labels.specialEvents;

      Title = Resources.labels.specialEvents + " - HRB";
    }

    protected void btnView_Click(object sender, EventArgs e)
    {
      string query = "LanguageID = " + _languageId.ToString()
        + " AND IsPublished='True'";
      if (ASPxDateEdit.Value != null)
        query += " AND DateCreated='" + ASPxDateEdit.Date.ToString("MM/dd/yyyy") + "'";
      EventsDataSource.Parameters.Clear();
      EventsDataSource.Parameters.Add("WhereClause", query);
      EventsDataSource.Parameters.Add("OrderBy", "DateCreated DESC");
    }
  }
}
